package common;

/**
 * Created by Administrator on 2017-12-06.
 */
public enum RoleId_roleName {
    ROLE_EMPLOYEE("普通员工",0),ROLE_MINISTER("部长",1),ROLE_MANAGE("总经理",2),ROLE_ADMIN("管理员",3);
    private String roleName;
    private int roleId;
    RoleId_roleName(String roleName, int roleId) {
        this.roleName = roleName;
        this.roleId = roleId;
    }

    public static int getRoleId(String roleName) {
        for (RoleId_roleName roleId_roleName : RoleId_roleName.values()) {
            if (roleId_roleName.getRoleName().equals(roleName)) {
                System.out.println(roleId_roleName.getRoleId());
                return roleId_roleName.getRoleId();
            }
        }
        return 0;
    }


    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public int getRoleId() {
        return roleId;
    }

    public void setRoleId(int roleId) {
        this.roleId = roleId;
    }
}
